<template>
	<view class="uni-popup-message">
      <view class="fontsize28 fb title" v-if="title.length>0">
        {{title}}
      </view>
      <text class="fontsize28 color64 paddingTopbom30">{{message}}</text>
      <view class="u-f-jsa paddingTopbom30" style="width: 100%;">
        <view class="cancel btn" @click="close(false)">{{cancelText}}</view>
        <view class="confirm btn" @click="close(true)">{{confirmText}}</view>
      </view>
		
	</view>
</template>

<script>
	
	/**
	 * PopUp 弹出层-消息提示
	 * @property {String} message 消息提示文字
	 * @property {String} duration 显示时间，设置为 0 则不会自动关闭
	 */
	
	export default {
		name: 'UniPopupMessage',
		props: {
      title:{
				type: String,
				default: ''
			},
			/**
			 * 主题 success/warning/info/error	  默认 success
			 */
			type: {
				type: String,
				default: 'info'
			},
			/**
			 * 消息文字
			 */
			message: {
				type: String,
				default: ''
			},
			/**
			 * 显示时间，设置为 0 则不会自动关闭
			 */
			duration: {
				type: Number,
				default: 3000
			},
      cancelText:{
        type: String,
        default: '取消'
      },
      confirmText:{
        type: String,
        default: '确认'
      }
		},
		inject: ['popup'],
		data() {
			return {}
		},
		methods: {
			close(flag) {
				this.$emit('close', {confirm:flag
				})
        this.popup.close()
			}
		}
	}
</script>
<style lang="scss" scoped>
	.uni-popup-message {
    padding: px2vw(32) px2vw(32) 0px;
    background-color: #FFFFFF;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    .btn{
      width:px2vw(150) ;
      height: px2vw(63);
      line-height:px2vw(63) ;
      border-radius: px2vw(32) ;
    }
    .cancel{
      border: 1px solid #00A2F0;
          background: #ffffff;
          color: #00a2f0;
    }
	}
</style>
